package jee.boot.entity.sms;

import com.fasterxml.jackson.annotation.JsonFormat;
import jee.boot.common.annotation.Column;
import jee.boot.common.annotation.Table;
import jee.boot.common.annotation.Transient;
import jee.boot.common.basic.DataEntity;
import jee.boot.entity.auth.Account;

import java.util.Date;

/**
 * 短信发送Entity
 *
 * @author zhilei.wang
 * @version 2018-09-28
 */
@Table(name = "st_sms")
public class Sms extends DataEntity<Sms> {
    /**
     * 短信接收人电话
     */
    private String phoneNumber;
    /**
     * 发送时间
     */
    private Date sendDate;
    /**
     * 短信内容
     */
    private String text;
    /**
     * 发送状态
     */
    private String sendStatus;
    /**
     * 发送信息
     */
    private String message;
    /**
     * 发送人
     */
    @Column(name = "send_user_id", data = {"sendUser.id", "sendUser.username"})
    private Account sendUser;
    /**
     * 短信签名
     */
    private String signName;
    /**
     * 模板编号
     */
    private String templateCode;
    /**
     * 模板里需要的参数,json格式
     */
    private String templateParam;
    /**
     * 请求ID
     */
    private String requestId;
    /**
     * 发送回执ID,可根据该ID查询具体的发送状态
     */
    private String bizId;
    /**
     * 状态码-返回OK代表请求成功
     */
    private String code;
    /**
     * 默认异步发送
     */
    @Transient
    private boolean asyn = true;

    public Sms() {
    }

    public Sms(String id) {
        super(id);
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date getSendDate() {
        return sendDate;
    }

    public void setSendDate(Date sendDate) {
        this.sendDate = sendDate;
    }

    public String getTemplateCode() {
        return templateCode;
    }

    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getSendStatus() {
        return sendStatus;
    }

    public void setSendStatus(String sendStatus) {
        this.sendStatus = sendStatus;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Account getSendUser() {
        return sendUser;
    }

    public void setSendUser(Account sendUser) {
        this.sendUser = sendUser;
    }

    public String getSignName() {
        return signName;
    }

    public void setSignName(String signName) {
        this.signName = signName;
    }

    public String getTemplateParam() {
        return templateParam;
    }

    public void setTemplateParam(String templateParam) {
        this.templateParam = templateParam;
    }

    public String getRequestId() {
        return requestId;
    }

    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    public String getBizId() {
        return bizId;
    }

    public void setBizId(String bizId) {
        this.bizId = bizId;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public boolean isAsyn() {
        return asyn;
    }

    public void setAsyn(boolean asyn) {
        this.asyn = asyn;
    }

    @Override
    public String toString() {
        return "Sms{" +
                "phoneNumber='" + phoneNumber + '\'' +
                ", sendDate=" + sendDate +
                ", text='" + text + '\'' +
                ", sendStatus='" + sendStatus + '\'' +
                ", message='" + message + '\'' +
                ", sendUser=" + sendUser +
                ", signName='" + signName + '\'' +
                ", templateCode='" + templateCode + '\'' +
                ", templateParam='" + templateParam + '\'' +
                ", requestId='" + requestId + '\'' +
                ", bizId='" + bizId + '\'' +
                ", code='" + code + '\'' +
                ", asyn=" + asyn +
                '}';
    }

    public static void main(String[] args) {
        System.out.println(new Sms().getGetSql());
    }
}
